package com.imay.live.helper;

import com.imay.live.R;

/**
 * Created by jeaman on 2017/4/18.
 */

public class LevelHelper {
    private final static int[] USER_NICK_COLOR = {R.color.nick_level_1, R.color.nick_level_2, R.color.nick_level_3, R.color.nick_level_4, R.color.nick_level_5, R.color.nick_level_6};
    private final static int[] USER_LEVEL_RES = {R.mipmap.ico_00yhdj01, R.mipmap.ico_00yhdj02, R.mipmap.ico_00yhdj03, R.mipmap.ico_00yhdj04, R.mipmap.ico_00yhdj05, R.mipmap.ico_00yhdj06};
    private final static int[] USER_LEVEL_SMALL_RES = {R.mipmap.ico_00yhdj01_1, R.mipmap.ico_00yhdj02_1, R.mipmap.ico_00yhdj03_1, R.mipmap.ico_00yhdj04_1, R.mipmap.ico_00yhdj05_1, R.mipmap.ico_00yhdj06_1};
    private final static int[] LIVE_LEVEL_RES = {R.mipmap.ico_00zbdj01, R.mipmap.ico_00zbdj02, R.mipmap.ico_00zbdj03, R.mipmap.ico_00zbdj04, R.mipmap.ico_00zbdj05, R.mipmap.ico_00zbdj06};
    private final static int[] LIVE_LEVEL_SMALL_RES = {R.mipmap.ico_00zbdj01_1, R.mipmap.ico_00zbdj02_1, R.mipmap.ico_00zbdj03_1, R.mipmap.ico_00zbdj04_1, R.mipmap.ico_00zbdj05_1, R.mipmap.ico_00zbdj06_1};
    private final static int[] LIVE_SEX = {R.mipmap.ico_00boy, R.mipmap.ico_00girl};

    //获取用户等级图标
    public static int getUserLevelResId(int userLevel) {
        int index = 5;
        if (userLevel < 10) {
            index = 0;
        } else if (userLevel < 20) {
            index = 1;
        } else if (userLevel < 30) {
            index = 2;
        } else if (userLevel < 40) {
            index = 3;
        } else if (userLevel < 46) {
            index = 4;
        }
        return USER_LEVEL_RES[index];
    }

    public static int getUserLevelSmallResId(int userLevel) {
        int index = 5;
        if (userLevel < 10) {
            index = 0;
        } else if (userLevel < 20) {
            index = 1;
        } else if (userLevel < 30) {
            index = 2;
        } else if (userLevel < 40) {
            index = 3;
        } else if (userLevel < 46) {
            index = 4;
        }
        return USER_LEVEL_SMALL_RES[index];
    }

    //获取直播等级图标
    public static int getLiveLevelResId(int liveLevel) {
        int index = 5;
        if (liveLevel < 10) {
            index = 0;
        } else if (liveLevel < 20) {
            index = 1;
        } else if (liveLevel < 30) {
            index = 2;
        } else if (liveLevel < 40) {
            index = 3;
        } else if (liveLevel < 46) {
            index = 4;
        }
        return LIVE_LEVEL_RES[index];
    }

    public static int getLiveLevelSmallResId(int liveLevel) {
        int index = 5;
        if (liveLevel < 10) {
            index = 0;
        } else if (liveLevel < 20) {
            index = 1;
        } else if (liveLevel < 30) {
            index = 2;
        } else if (liveLevel < 40) {
            index = 3;
        } else if (liveLevel < 46) {
            index = 4;
        }
        return LIVE_LEVEL_SMALL_RES[index];
    }

    public static int getUserNickColor(int userLevel) {
        int index = 5;
        if (userLevel < 10) {
            index = 0;
        } else if (userLevel < 20) {
            index = 1;
        } else if (userLevel < 30) {
            index = 2;
        } else if (userLevel < 40) {
            index = 3;
        } else if (userLevel < 46) {
            index = 4;
        }
        return USER_NICK_COLOR[index];
    }

    public static final int getVIPIcon(int vip) {
        int imageId = 0;
        switch (vip) {
            case 1:
                imageId = R.mipmap.ico_00v_big;
                break;
            case 2:
                imageId = R.mipmap.ico_05_v_big;
                break;
        }
        return imageId;
    }

    public static final int getVIPIcon(int OfficialVip, int LargeVipStatus) {
        if (OfficialVip == 1) { //官方V认证
            return R.mipmap.ico_05_v_big;
        } else if (LargeVipStatus == 3) {   //大V认证
            return R.mipmap.ico_00v_big;
        }
        return 0;
    }

    public static final int getVIPSmallIcon(int OfficialVip, int LargeVipStatus) {
        if (OfficialVip == 1) { //官方V认证
            return R.mipmap.ico_05_v_small;
        } else if (LargeVipStatus == 3) {   //大V认证
            return R.mipmap.ico_00v_small;
        }
        return 0;
    }

    private static final int getBadgeResId(int OfficialVip, int LargeVipStatus, int level, boolean live) {
        if (OfficialVip == 1) { //官方V认证
            return R.mipmap.ico_05_v_small;
        } else if (LargeVipStatus == 3) {   //大V认证
            return R.mipmap.ico_00v_small;
        } else {
            if (live) {
                return getLiveLevelSmallResId(level);
            } else {
                return getUserLevelSmallResId(level);
            }
        }
    }

    public static final int getUserBadgeResId(int officialVip, int largeVipStatus, int userLevel) {
        return getBadgeResId(officialVip, largeVipStatus, userLevel, false);
    }

    public static final int getLiveBadgeResId(int officialVip, int largeVipStatus, int liveLevel) {
        return getBadgeResId(officialVip, largeVipStatus, liveLevel, true);
    }

    public static final int getSexResId(int sexid) {
        if (sexid == 1) {
            return LIVE_SEX[0];
        } else if (sexid == 2) {
            return LIVE_SEX[1];
        }
        return LIVE_SEX[0];
    }
}
